package reflect;

import reflect.annotations.AutoRunClass;
import reflect.annotations.AutoRunMethod;

@AutoRunClass
public class Person {
    private String name = "张三";
    private int age = 19;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Person(String name) {
        this.name = name;
    }

    public Person() {
    }
    @AutoRunMethod(2)
    public void sayHello() {
        System.out.println(name + ":hello");
    }

    @AutoRunMethod(6)
    public void sayHi() {
        System.out.println(name + ":hi");
    }

    public void dosomething() {
        System.out.println(name + "do something");
    }

    public void sleep() {
        System.out.println(name + "sleep");
    }

    @AutoRunMethod
    public void watchTV() {
        System.out.println(name + "watch TV");
    }

    public void study() {
        System.out.println(name + "study");
    }

    @AutoRunMethod
    public void playGame() {
        System.out.println(name + "play game");
    }


    public void sing() {
        System.out.println(name + "sing");
    }

    public void say(String info) {
        System.out.println(name + ":" + info);
    }

    public void say(String info, int num)
            throws IllegalArgumentException, IllegalAccessException {
        for (int i = 0; i < num; i++) {
            System.out.println(name + ":" + info);
        }
    }

    private void hehe() {
        System.out.println("我是person的私有方法hehe");
    }


    public String getName() {
        return name;
    }


    public void setName(String name) {
        this.name = name;
    }


    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
